﻿#region Copyright Information
// // ****************************************************************
// // Feel free to extend or modify the code of the application to your needs. 
// // But remember do it for the Glory of our Lord Jesus Christ
// // ****************************************************************
#endregion
#region Usings

using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Interfaces.Services;
using NLog;

#endregion

namespace Services.ScreenManager
{
	/// <summary>
	/// Manages the Graphics Devices on the present machine.
	/// </summary>
	public class ScreenManager : IScreenManager
	{
		/// <summary>
		/// Reference to logging tool.
		/// </summary>
		private readonly static Logger logging = LogManager.GetCurrentClassLogger();

		/// <summary>
		///  All the screen of the present machine.
		/// </summary>
		/// <returns></returns>
		public IEnumerable<Screen> GetScreens()
		{
			logging.Info("Retrieve all available screens.");
			return Screen.AllScreens;
		}

		/// <summary>
		/// The monitor that the user will use at first run.
		/// </summary>
		/// <returns>Screen object.</returns>
		/// <remarks>
		/// If there is only one then set it as the default one.
		/// Otherwise set it to the last screen available.
		/// </remarks>
		public Screen ScreenToUse
		{
			get
			{
				return Screen.AllScreens.Count() == 1
					? Screen.AllScreens.First()
					: Screen.AllScreens.Last();
			}
		}

		///// <summary>
		///// Populate the combobox with all the screens available.
		///// </summary>
		///// <param name="items">All the screens.</param>
		//public void SetItems(IEnumerable<string> items)
		//{
		//    Screens.ItemsSource = items;
		//    Screens.SelectedItem = items.ElementAt(0);
		//}

		///// <summary>
		///// Returns the selected screen.
		///// </summary>
		//public string SelectedScreen
		//{
		//    get { return Screens.SelectedItem.ToString(); }
		//}
	}
}